//
//  RlConst.h
//  Rail
//
//  Created by hychen on 2018/2/24.
//  Copyright © 2018年 Hychen. All rights reserved.
//

#ifndef RlConst_h
#define RlConst_h

//弱引用申明
#define BMWeakSelf __weak __typeof(self) weakSelf = self;
#define BMStrongSelf __strong __typeof(self) strongSelf = weakSelf;
#define BMBlockSelf __block __typeof(self) weakSelf = self;

#define BMNotificationCenter [NSNotificationCenter defaultCenter]
#define BMScreenHeight [UIScreen mainScreen].bounds.size.height
#define BMScreenWidth [UIScreen mainScreen].bounds.size.width
#define BMDeviceHeight [UIScreen mainScreen].bounds.size.height
#define BMDeviceWidth [UIScreen mainScreen].bounds.size.width

#define BMStrIsEmpty(str) ([str isKindOfClass:[NSNull class]] || [str length] < 1 ? YES : NO || [str isEqualToString:@"(null)"] || [str isEqualToString:@"null"])

//随机色
#define BMRandomColor [UIColor colorWithRed:arc4random_uniform(256) / 255.0 green:arc4random_uniform(256) / 255.0 blue:arc4random_uniform(256) / 255.0 alpha:1.0]

// RGB颜色
#define BMColor(r, g, b) [UIColor colorWithRed:(r) / 255.0 green:(g) / 255.0 blue:(b) / 255.0 alpha:1.0]
#define BMAlphaColor(r, g, b, a) [UIColor colorWithRed:r / 255.0 green:g / 255.0 blue:b / 255.0 alpha:a]
#define BMHexColor(X) [UIColor colorWithRed:((float) ((X & 0xFF0000) >> 16)) / 255.0 green:((float) ((X & 0xFF00) >> 8)) / 255.0 blue:((float) (X & 0xFF)) / 255.0 alpha:1.0]
#define BMHexColorA(X, A) [UIColor colorWithRed:((float) ((X & 0xFF0000) >> 16)) / 255.0 green:((float) ((X & 0xFF00) >> 8)) / 255.0 blue:((float) (X & 0xFF)) / 255.0 alpha:A]

// 是否为iOS9,获得系统版本
#define IOS9 ([[UIDevice currentDevice].systemVersion doubleValue] >= 9.0)
// 是否为iOS7,获得系统版本
#define IOS7 ([[UIDevice currentDevice].systemVersion doubleValue] >= 7.0)
// 是否为iOS8,获得系统版本
#define IOS8 ([[UIDevice currentDevice].systemVersion doubleValue] >= 8.0)

#define iPhone5_Screen ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6_Screen ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6Plus_Screen ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
#define IPHONEX_SCREEN ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) // 375 * 812

#endif /* RlConst_h */
